package com.seeTools.next.service.member.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.seeTools.next.api.entity.member.MemberInfo;
import com.seeTools.next.common.core.PageQuery;
import com.seeTools.next.mapper.member.MemberInfoMapper;
import com.seeTools.next.service.BaseServiceImpl;
import com.seeTools.next.service.member.MemberInfoService;
import com.seeTools.next.util.PageQueryHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author seeTools
 * @since 2025-08-27
 */
@Service
public class MemberInfoServiceImpl extends BaseServiceImpl<MemberInfoMapper, MemberInfo> implements MemberInfoService {

    protected Logger logger = LoggerFactory.getLogger(getClass());


    @Resource
    private PageQueryHelper<MemberInfo> pageQueryHelper;

    /**
     * 分页查询
     *
     * @param pageQuery 分页数据
     * @return 对象
     */
    @Override
    public Page<MemberInfo> findList(PageQuery<MemberInfo> pageQuery) {
        QueryWrapper<MemberInfo> queryWrapper = getQueryWrapper(pageQuery.getParams());
        return dictionary(pageQueryHelper.pageInfo(this, pageQuery, queryWrapper));
    }

    /**
     * 查询数据
     *
     * @param model
     * @return
     */
    @Override
    public List<MemberInfo> selectDataList(MemberInfo model) {
        QueryWrapper<MemberInfo> queryWrapper = getQueryWrapper(model);
        return dictionary(list(queryWrapper));
    }

    /**
     * 获取查询条件
     *
     * @param model
     * @return
     */
    public QueryWrapper<MemberInfo> getQueryWrapper(MemberInfo model) {
        QueryWrapper<MemberInfo> queryWrapper = new QueryWrapper<>();
        LambdaQueryWrapper<MemberInfo> lambdaQueryWrapper = queryWrapper.lambda();
        if (ObjectUtil.isNotEmpty(model)) {

        }
        return queryWrapper;
    }


    /**
     * 翻译数据
     *
     * @param page
     * @return
     */
    public Page<MemberInfo> dictionary(Page<MemberInfo> page) {
        if (ObjectUtil.isNotEmpty(page)) {
            List<MemberInfo> list = page.getRecords();
            dictionary(list);
        }
        return page;
    }

    /**
     * 翻译
     *
     * @param list
     * @return
     */
    public List<MemberInfo> dictionary(List<MemberInfo> list) {
        if (CollUtil.isNotEmpty(list)) {
            list.forEach(item -> {
            });
        }
        return list;
    }
}


